import actionType from "./actionType";

const initState = {
  requestParams: {
    index: 0,
    num: 10,
    devName: "",
    devLocation: "",
    level: 0,
    addrArray: [""],
    deviceCode: '',

  },
  devTableList: {
    data:[],
    count:0
  }
};

const equipmentReducers = (state = initState, action: any) => {
  switch (action.type) {
    case actionType.SET_EQUIPMENT_PARAMS:
      return {
        ...state,
        requestParams: {
          ...state.requestParams,
          ...action.payload
        }
      };

    case actionType.GET_EQUIPMENT:
      return {
        ...state,
        devTableList: action.payload
      };

    default:
      return state;
  }
};
export default equipmentReducers;
